<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE HTML>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no">
    <meta content="yes" name="apple-mobile-web-app-capable" />
    <meta content="email=no" name="format-detection"/>
    <meta content="telephone=no" name="format-detection" />
    <link href="/Public/css/layout.css" type="text/css" rel="stylesheet" >
    <script src="/Public/js/jquery-1.10.1.min.js"></script>
    <script src="/Public/js/TouchSlide.1.1.js"></script>
</head>
<body>
<div class="head">
    <div class="head-cont"><a href="javascript:history.back();"><i class="icon-iconfont-fanhui"></i> </a><span class="head-tit">健康知识</span> </div>
</div>
<div class="knowledgeList-menu"> </div>
<div class="page-ff">
    <div class="h45"></div>
    <div class="knowledgeList-main">
        <div id="leftTabBox" class="tabBox">
            <div class="hd">
                <ul>
                    <?php $cate_count = count($category); for($i = 1;$i <$cate_count+1;$i++){ ?>
                            <li><a href="#"><?php echo ($category[$i]['title']); ?></a></li>
                    <?php } ?>
                </ul>
            </div>
            <div class="bd">
                <ul>
                    <li class="knowList-t">
                        <div class="knowList-pic"><img src="/Public/images/pic01.jpg" width="100%"/><span class="knowList-pic-tit"><span>运动后如何正确喝水</span></span></div>
                        <div class="knowList-con" id="wrapper">
                            <ul class="know-ul" id="know-ul-0">
                                <?php foreach($list_news as $key => $value){ ?>
                                <li class="know-li"><a href="/news/<?php echo ($value['id']); ?>"><img src="<?php echo ($tngou_image_prefix); echo ($value['img']); ?>_120x80" class="know-img">
                                <span class="know-right"><span class="know-right-tit"><?php echo ($value['title']); ?></span><span class="know-right-info">
                                  <span class="know-right-pls">已读 <?php echo ($value['count']); ?></span>
                                  <span class="<?php echo ($category[$value['loreclass']]['class']); ?>"><?php echo ($category[$value['loreclass']]['title']); ?></span></span></span>
                                </a>
                                </li>
                                <?php } ?>
                            </ul>
                            <div class="load-more"><span>查看更多</span></div>
                        </div>
                    </li>
                </ul>
                <?php for($j=1;$j<$cate_count+1;$j++){ ?>
                <ul>
                    <li class="knowList-t">
                        <div class="knowList-pic"><img src="/Public/images/pic01.jpg" width="100%"/><span class="knowList-pic-tit"><span>运动后如何正确喝水</span></span></div>
                        <div class="knowList-con">
                            <ul class="know-ul" id="know-ul-<?php echo ($j); ?>">
                            </ul>
                            <div class="load-more"><span>查看更多</span></div>
                        </div>
                    </li>
                </ul>
                <?php } ?>
                <div class="load-more"><span>查看更多</span></div>
            </div>
        </div>
    </div>
    <script type="text/javascript">

        TouchSlide({ slideCell:"#leftTabBox",
        startFun:function(j,c){
            if(j != 0){
                //如果该ul里面有数据则，无需再次加载
                if($("#know-ul-"+j).text().trim() == ''){
                    $.ajax({
                        url: '/nList/' + (j + 1) + '?type=xhr',
                        type: 'get',
                        dataType: 'json',
                        beforeSend: function () {
                            window.document.body.scrollTop=0;
                            $("#know-ul-" + j).append('<li class="know-li" id="loading" style="text-align: center"><img src="/Public/images/loading.gif">正在加载中.....</li>')

                        },
                        success: function (msg) {
                            li = '';
                            for (i = 0; i < msg.list_news.length; i++) {
                                info = msg.list_news[i];
                                li += '<a href="/news/'+ info['id'] +'"><li class="know-li"><img src="<?php echo ($tngou_image_prefix); ?>' + info['img'] + '_120x80" class="know-img">' +
                                        '<span class="know-right"><span class="know-right-tit">' + info['title'] + '</span><span class="know-right-info">' +
                                        '<span class="know-right-pls">已读 ' + info['count'] + '</span>' +
                                        '<span class="' + msg.category_class + '">' + msg.category + '</span></span></span></li></a>'
                            }
                            $("#know-ul-" + j).empty().append(li);
                        }
                    })
                }else{
                    return true;
                }
            }
    }});
    </script>
</div>
</body>
</html>